<?php 
get_header();
$uid = get_current_user_id();
?>
<style>
	.author{
		position: relative;
		margin: 0 auto;
		text-align: center;
		padding: 10px;
	}
	.author_set .title img{
		border-radius:50%; 
	}
	.author_fanc{
		margin: 10px auto;
	}
	.author_fanc>li
	{
		width: calc(25% - 10px);
		display: inline-block;
	}
	.author_option{
		text-align: left;
	}
</style>
<div class="layui-row">
	<div class="layui-col-md4">
		<div class="layui-card">
		    <div class="layui-card-body author">
				<ul class="author_set">
					<li class="title">
						<a href="<?php echo get_bloginfo('url'); ?>/?author=<?php echo $uid; ?>">
							<?php echo get_avatar($uid); //获取作者头像  ?>
							<br>
							<span><?php echo get_user_meta($uid, 'nickname')[0]; //用户呢称作为博客名  ?></span>
						</a>
					</li>
					<li class="write">
						<?php
						if ($current_user->ID == $uid) {
						    echo '<a class="layui-btn layui-btn-primary" href="' . get_bloginfo("url") . '/?author=' . $uid . '&act=author_write">写博客</a>';
						    echo '<a class="layui-btn layui-btn-primary" href="' . get_bloginfo("url") . '/?author=' . $uid . '&act=user_edit">帐号设置</a>';
						} else {
						    $user_follow = get_user_meta($current_user->ID, 'user_follow');
						    $arr         = explode(',', $user_follow[0]);
						    if (!in_array($uid, $arr)) {
						        echo '<a class="layui-btn layui-btn-primary" href="javascript:;" id="' . $uid . '" class="guan_zu guan_zu_' . $uid . '">关注</a>';
						    } else {
						        echo '<a class="layui-btn layui-btn-primary" href="javascript:;" id="' . $uid . '" class="quxiao quxiao_' . $uid . '">已关注</a>';
						    }
						}
						?>
					</li>
				</ul>
				<ul class="author_fanc">
					<li class="jifen_list">
						<a href="<?php echo get_bloginfo("url"); ?>/author_jifen">
							<span>
							<?php
							//注册积分
							echo get_jefen($uid) ;
							?>
							</span>
							<br>
							<span>积分</span>
						</a>
					</li>
					<li id="<?php echo $uid; ?>" class="guanzu_list">
						<a href="<?php echo get_bloginfo("url"); ?>/?author=<?php echo $uid;?>&act=guanzu">
							<span><?php echo get_guanzu($uid); ?></span><br><span>关注</span>
						</a>
					</li>
					<li id="<?php echo $uid; ?>" class="fanc_list">
						<a href="<?php echo get_bloginfo("url"); ?>/?author=<?php echo $uid;?>&act=fanc">
							<span><?php echo get_fanc($uid); ?></span><br><span>粉丝</span>
						</a>
					</li>
					<li class="wenzang_list">
						<a href="<?php echo get_bloginfo("url"); ?>/?author=<?php echo $uid;?>&act=list">
							<span><?php echo get_the_author_posts(); //作者文章总数 ?></span><br><span>文章</span>
						</a>
					</li>
				</ul>
				<hr>
				<hr>
				<ul class="author_option">
					<li>文章浏览：<?php echo get_post_views($uid) ?></li>
					<li>个人网站：<?php echo get_user_meta($uid,'user_site')[0]; ?></li>
					<li>加入时间：<?php echo get_the_author_meta( 'user_registered',  $uid); //注册时间 ?></li>
					<li>最近登录：<?php echo get_user_meta($uid, 'last_login', true); ?></li>
				</ul>
			</div>
		</div>
	</div>
	<div class="layui-col-md7 layui-col-md-offset1" style="width: calc(66.6666666% - 10px);margin-left: 10px;">
		<div class="layui-card">
			<div class="layui-card-header">作者文章</div>
		    <div class="layui-card-body">
			<?php
			$args = array(
			    'orderby' => 'date',
			);
			$arms = array_merge($args, $wp_query->query);
			query_posts($arms);
			?>
			<?php if (have_posts()): while (have_posts()): the_post();?>
			<article class="postcard" itemscope="" itemtype="https://schema.org/Blog" >
			    <?php if (is_has_image() || kbk('showdefaultthumb') == true): ?>
				    <div class="thumb">
				        <img src='<?php echo get_template_directory_uri() . '/assert/img/loading.png' ?>' class="lazyload" data-original='<?php echo getThumb(catch_that_image(), 210, 160) ?>' alt="[<?php the_title();?>]的缩略图">
				    </div>
				<?php endif;?>
			    <div class="postinfo" >
			        <div class="posttitle">
			            <a href='<?php the_permalink();?>'>
			                <?php the_title();?>
			            </a>
			        </div>
			        <div class="postexpert layui-hide-xs">
			            <?php the_excerpt();?>
			        </div>
			        <div class="expost layui-hide-xs">
			            <?php __author_with_category();?>
			            <div style="display: inline;float: right;">
			            	<?php echo __time(get_gmt_from_date(get_the_time('Y-m-d G:i:s'))); ?>
			            </div>
			        </div>
			    </div>
			</article>
			<hr>
			<?php endwhile;
			endif;
			wp_reset_query();
			weihuan_paginate();
			?>
			</div>
		</div>
	</div>
</div>
<?php get_footer();?>